package com.broad.data.storage.web.storage.web;

import com.broad.data.storage.core.config.AcmeProperties;
import com.broad.data.storage.core.config.DefaultMyPojo;
import com.broad.data.storage.core.config.MyPojo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@SpringBootApplication
@ComponentScan(basePackages = "com.broad.data.storage")
@Slf4j
@RestController
@RequestMapping(value = "/props")
public class StorageWebApplication {

    @Autowired
    private AcmeProperties acmeProperties;

    public static void main(String[] args) {
        SpringApplication.run(StorageWebApplication.class, args);
    }

    @GetMapping(value = "/")
    public String props() {
        MyPojo myPojoList = acmeProperties.getMyPojo();
        DefaultMyPojo defaultMyPojo = acmeProperties.getDefaultMyPojo();
        log.info(defaultMyPojo.getDefaultName());
        log.info(myPojoList.getFirstName());
        return "success";
    }

}

